@extends('front.common.header')
@section('title', $jobs->title.' - 职位详情 - 企业招聘')

@section('header')
@parent
@stop

@section('content')
<link href="{{ asset('/addons/icheck-1.x/skins/flat/blue.css') }}" rel="stylesheet">
<script src="{{ asset('/addons/icheck-1.x/icheck.min.js') }}" type="text/javascript"></script>
<link href="{{ asset('/css/company/jobs.css') }}" rel="stylesheet" type="text/css">
<link href="{{ asset('/css/company/comdetails.css') }}" rel="stylesheet" type="text/css">
<link href="{{ asset('/css/countdown.css') }}" rel="stylesheet" type="text/css">
<script src="{{ asset('/js/jquery.countdown.js') }}" type="text/javascript"></script>
<script src="{{ asset('/js/company/jquery.jcarousel.min.js') }}" type="text/javascript"></script>
<script src="{{ asset('/js/company/jcarousel.connected-carousels.js') }}" type="text/javascript"></script>
{{-- 主体内容 --}}
<div id="jobs-main-content">
    @if($jobs)
    {{-- 面包屑导航 --}}
    <div id="com-details-menu">
        <ul>
            <li class="first"><a href="/" target="_blank">首页</a></li>
            <li><span>|</span></li>
            <li><a href="{{ url('/company') }}" target="_self">企业招聘</a></li>
            <li><span>|</span></li>
            <li><a href="{{ url('/company/list?typeid=1')}}" target="_self">热门职位</a></li>
            <li><span>|</span></li>
            <li class="last">
                <a href="{{ url('/company/list?typeid=1')}}">{{str_limit($jobs->title,8)}}&nbsp;<i class="icon-remove c9"></i></a>
            </li>
        </ul>
    </div>
    <div id="com-details-wrap">
        {{-- 左侧内容 --}}
        <div id="com-details-wrap-left" class="fl mr10">
            {{-- 职位基础信息 --}}
            <div id="jobs-base">
                <div class="jobs-base-tit">
                    <div class="jobs-title fl fs24 c3">{{$jobs->title}}</div>
                    <div class="jobs-link fr" id="goDelivery">
                        @if(count($jobs->examination)>0 && $jobs->test == 1)
                        @if($isToDelivery == 1)
                        <a href="javascript:;">已申请</a>
                        @else
                        <a href="javascript:;" onclick="toExaminations({{ empty($authuser)?0:$authuser->id }})">职位申请</a>
                        @endif
                        @else
                        @if($isToDelivery == 1)
                        <a href="javascript:;">已申请</a>
                        @else
                        <form id="deliveryForm">
                        {!! csrf_field() !!}
                        <input type="hidden" name="company_id" value="{{$company->id}}">
                        <input type="hidden" name="job_id" value="{{$jobs->jobs_id}}">
                        <a href="javascript:;" @if(empty($authuser)) onclick="loginTips()" @else onclick="deliveryResume('/member/delive/resume','deliveryForm')" @endif>职位申请</a>
                        </form>
                        @endif
                        @endif
                    </div>
                    <div class="clr"></div>
                </div>
                <div class="jobs-base-info">
                    <div class="jobs-base-info-l fl">
                        <p class="fs14 c6">职位月薪：
                        @if(($jobs->salary_lower == 0 || empty($jobs->salary_lower)) && ($jobs->salary_high == 0 || empty($jobs->salary_high)))
                        面议
                        @elseif(($jobs->salary_lower == 0 || empty($jobs->salary_lower)) && $jobs->salary_high > 0)
                        {{$jobs->salary_high}}k以下
                        @else
                        {{ $jobs->salary_lower }}k-{{ $jobs->salary_high }}k
                        @endif
                        </p>
                        <p class="fs14 c6">发布日期：{{date('Y-m-d',strtotime($jobs->published_at))}}</p>
                        <p class="fs14 c6">工作经验：{{$jobs->gznx_name}}</p>
                        <p class="fs14 c6">招聘人数：
                            @if($jobs->recruitment>0)
                                {{$jobs->recruitment}}人
                            @else
                                不限
                            @endif
                        </p>
                    </div>
                    <div class="jobs-base-info-r fl">
                        <p class="fs14 c6">工作地点：{{$jobs->areas->title}}</p>
                        <p class="fs14 c6">工作性质：{{$jobs->gzxz_name}}</p>
                        <p class="fs14 c6">最低学历：{{$jobs->degree_name}}</p>
                        <p class="fs14 c6">职位类别：
                            {{--{{$jobs->sub_catname}}/{{$jobs->category->name}}--}}
                            @if(count($jobs->category)>0)
                                @if(count($jobs->category->parentCate)> 0 )
                                    {{$jobs->category->parentCate->name}} / {{ $jobs->category->name }}
                                @else
                                    {{ count($jobs->category)>0 ? $jobs->category->name : '无' }}
                                @endif
                            @else
                                无
                            @endif
                        </p>
                    </div>
                    <div class="clr"></div>
                </div>
                <div class="jobs-tags">
                    @foreach($tags as $tag)
                    <span>{{ $tag }}</span>
                    @endforeach
                </div>
            </div>

            {{-- 职位描述 --}}
            <div id="jobs-intr">
                <h4 class="c0 pt15 pb15 pl20 ma0">职位描述</h4>
                <div id="jobs-intr-main">
                   {!! $jobs->description !!}
                </div>
                <div class=" jobs-intro-more">
                    {!! $jobs->intro !!}
                </div>
            </div>

            {{-- 应聘考试 --}}
            @if(count($jobs->examination)>0 && $jobs->test == 1)
            <div id="jobs-exam">
                <h4 class="c0 pt15 pb15 pl20 ma0">应聘考试</h4>
                <div id="jobs-exam-main" class="row show-grid">
                    <div class="col-xs-10 col-sm-10 col-md-10">
                      <p class="ma lh38 fs16 c6">如果您对我们的岗位感兴趣,请投简历之前参与应聘考试,以便更好的对您进行评估。</p>
                    </div>
                    <div class="col-xs-2 col-sm-2 col-md-2">
                        <div class="jobs-exam-link" id="goExam">
                            @if($isToDelivery == 1)
                            <a href="javascript:;">已参与</a>
                            @else
                            <a href="javascript:;" onclick="toExaminations({{ empty($authuser)?0:$authuser->id }})">开始考试</a>
                            @endif
                        </div>
                    </div>
                </div>
            </div>
            @endif
            {{-- 企业风采 --}}
             @if( count($photos) > 0 )
            <div id="jobs-show-imgs">
                <h4 class="c0 pt15 pb15 pl20 ma0">企业风采</h4>
                <!-- 轮播-->
                <div id="show-big-imgs">
                    <div class="connected-carousels">
                        <div class="stage">
                            <div class="carousel carousel-stage">
                                <ul>
                                  @foreach($photos as $key=>$photo)
                                    <li><img src="{{ $photo->path }}" width="882" height="480" alt=""></li>
                                  @endforeach
                                </ul>
                            </div>
                        </div>
                        <div class="navigation">
                            <a href="#" class="prev prev-navigation"></a>
                            <a href="#" class="next next-navigation"></a>
                            <div class="carousel carousel-navigation">
                                <ul>
                                    @foreach($photos as $key=>$photo)
                                    <li><img src="{{ $photo->path }}" width="98" height="66" alt=""></li>
                                    @endforeach
                                </ul>
                            </div>
                        </div>
                    </div>


                </div>
            </div>
            @endif
            {{-- 企业招聘 --}}
            <div id="com-jobs-list">
                <h4 class="c0 pt15 pb15 pl20 ma0">企业招聘</h4>
                @foreach($jobslist as $key => $job)
                <div id="jobs-list-main" class="row show-grid" @if($key == (count($jobslist)-1)) style="border:none;" @endif>
                    <div class="col-xs-10 col-sm-10 col-md-10">
                        <p class="ma lh38 fs16 c3">{{$job->areas->title}}&minus;{{$job->title}}&nbsp;({{$job->gzxz_name}})</p>
                        <p class="ma lh38 fs14 c3">月薪：<em class="cff">
                            @if(($job->salary_lower == 0 || empty($job->salary_lower)) && ($job->salary_high == 0 || empty($job->salary_high)))
                            面议
                            @elseif(($job->salary_lower == 0 || empty($job->salary_lower)) && $job->salary_high > 0)
                            {{$job->salary_high}}k以下
                            @else
                            {{ $job->salary_lower }}k-{{ $job->salary_high }}k
                            @endif
                        </em></p>
                    </div>
                    <div class="col-xs-2 col-sm-2 col-md-2">
                        <div class="jobs-details-link">
                            <a href="{{ url('/company/detail?typeid=1&jobsid='.$job->jobs_id) }}" target="_self">了解详情</a>
                        </div>
                    </div>
                </div>
                @endforeach
            </div>

            {{-- 企业评论 --}}
            <div id="com-comments-list">
                <h4 class="c0 pt15 pb15 pl20 ma0">全部评论</h4>
                <div id="itemContainer" >
                    @foreach($comments as $k=>$vo)
                    <div class="comment-common" id="comment-common{{$k}}">
                        <div class="comment-user-avatar fl pt10">
                            <img src="{{userlogo($vo->user_id,'middle')}}">
                        </div>
                        <div class="comment-main fl">
                            <div class="comment-content text-left">
                                <p class="font-20 c3">{{getUserName($vo->user_id)}}</p>
                                <p class="fs14 c5">{{$vo->content}}</p>
                                <div class="fs14 c9 ma0">
                                    <div class="fl">
                                        {{$vo->created_at}}&nbsp;&nbsp;&nbsp;&nbsp;
                                        <a href="javascript:;" onclick="showreply({{$vo->comment_id}})">回复</a>
                                    </div>
                                    <div class="fr mr15">
                                        <img src="{{ asset('/images/front/jiuyezhinan/pl.png') }}">
                                        @if(count($vo->childComments)>0)
                                        <input type="text" name="totalnum{{$vo->comment_id}}" value="{{count($vo->childComments)}}" readonly="readonly">
                                        @else
                                        <input type="text" name="totalnum{{$vo->comment_id}}" value="0" readonly="readonly">
                                        @endif
                                    </div>
                                    <div class="clr"></div>
                                </div>
                            </div>
                            <div id="comment-reply{{$vo->comment_id}}" class="comment-reply-form mt20 dn">
                                <div class="comment-reply-form-b">
                                    <textarea id="comment-reply-content{{$vo->comment_id}}" class="fl" placeholder="人可以走,留下你的态度"></textarea>
                                    <button type="button" id="submit{{$vo->comment_id}}" class="fr" @if(empty($authuser))onclick="loginTips()" @else onclick="pushComment('/comment/push?typeid=1','{{$vo->comment_id}}','{{$vo->user_id}}','{{$job->jobs_id}}','{{$job->company_id}}','{{ csrf_token() }}')" @endif>发表回复</button>
                                </div>
                            </div>
                            <div id="message{{$vo->comment_id}}" class="commentmsg dn"></div>
                            <div class="comment-child text-left" id="comment-childs{{$vo->comment_id}}">
                                @if(count($vo->childComments)>0)
                                <div class="comment-caret-up"><i class="glyphicon glyphicon-triangle-top"></i></div>
                                <div class="comment-child-content" id="comment-child-content{{$vo->comment_id}}">
                                    @foreach($vo->childComments as $key=>$zn)
                                    @if($key<3)
                                    <div class="comment-child-content-list" >
                                        <p class="fs18 color-green">{{getUserName($zn->user_id)}}：</p>
                                        <p class="fs14 c5">{{$zn->content}}</p>
                                    </div>
                                    @endif
                                    @endforeach
                                </div>
                                @endif
                            </div>
                        </div>
                        <div class="clr"></div>
                    </div>
                    @endforeach
                </div>
                {{-- 分页 --}}
                <div id="holder" @if(count($comments)== 0) class="holder dn" @else class="holder" @endif></div>
                <script>
                   jPages();
                </script>
                <div class="comment-reply-main">
                    <textarea id="comment-reply-content" placeholder="人可以走,留下你的态度"></textarea>
                    <div class="mb20 lh44 mt10">
                        <div id="message" class="fl"></div>
                        <button type="button" class="fr" id="submit-main" @if(empty($authuser))onclick="loginTips()" @else onclick="comment('/comment/push?typeid=1','{{$jobs->jobs_id}}','{{$jobs->company_id}}','1','{{ csrf_token() }}')" @endif>发表回复</button>
                    </div>
                </div>
            </div>
        </div>
        {{-- 右侧内容 --}}
        <div id="com-details-wrap-right" class="fl">
            {{-- 企业信息 --}}
            <div id="com-info">
                <h4 class="c0 pt15 pb15 pl20 ma0">企业信息</h4>
                <div id="com-info-main">
                    <div class="com-small-logo">
                        <a href="{{ url('/company/detail?typeid=2&comid='.$company->id) }}" target="_self">
                            <img src="{{$company->logo}}">
                        </a>
                    </div>
                    <p class="fs16 c3 tac">
                        <a href="{{ url('/company/detail?typeid=2&comid='.$company->id) }}" target="_self" class="c3" title="{{$company->name}}">
                            {{str_limit($company->name,24)}}
                        </a>
                    </p>
                    <div class="fs14 c3" style="height: auto;margin: 0 0 10px;">
                        行业：
                        <span style="display: inline-block; float: right; width: 165px">
                        @foreach($types as $types)
                        <span class="c6" style="display: inline-block; padding:0 2px;height: 18px;line-height: 18px;">
                        {{$types}}
                        </span>
                        @endforeach
                        </span>
                        <div class="clr"></div>
                    </div>
                    <p class="fs14 c3">规模：&nbsp;<em class="c6">{{$company->scale_name}}</em></p>
                    <p class="fs14 c3 cp" title="{{$company->area_name}}{{$company->address}}">地址：&nbsp;<em class="c6">{{$company->area_name}}{{str_limit($company->address, 16)}}</em></p>
                    {{--<p class="fs14 c3">电话：&nbsp;<em class="c6">{{$company->phone}}</em></p>--}}
                    <p class="fs14 c3">电话：&nbsp;<em class="c6">{{$company->tel}}</em></p>
                    <p class="fs14 c3">邮编：&nbsp;<em class="c6">{{empty($company->zip_code)?'':$company->zip_code}}</em></p>
                    <p class="fs14 c3 cp" title="{{$company->bus_route}}">路线：&nbsp;<em class="c6">{{str_limit($company->bus_route, 16)}}</em></p>
                    <div class="baidu-map">
                        <div id="allmap"></div>
                    </div>
                    <p class="fs14 c9 tac">
                        <a href="javascript:;" title="{{$company->name}}" onclick="showmap('/map?cid={{$company->id}}','{{$company->name}}');">查看完整地图</a>
                        <input type="hidden" name="longitude" id="longitude" value="{{$company->longitude}}">
                        <input type="hidden" name="latitude" id="latitude" value="{{$company->latitude}}">
                    </p>
                </div>
                <script type="text/javascript">
                    $(function(){
                        cmap('{{$company->area_name}}','{{$company->address}}');
                    });
                </script>
            </div>
            {{-- 相似职位 --}}
            @if(count($likejobs)>0)
            <div id="jobs-recommend">
                <h4 class="c0 pt15 pb15 pl20 ma0">相似职位</h4>
                <div id="jobs-recommend-list">
                    @foreach($likejobs as $key => $ljobs)
                    <div @if($key == (count($likejobs)-1)) class="recommend-list bbn" @else  class="recommend-list" @endif>
                       <p class="fs16 c3 pl10">
                           <a href="{{ url('/company/detail?typeid=1&jobsid='.$ljobs->jobs_id) }}" target="_self" class="fs14 c3">
                              {{ str_limit($ljobs->title, 18) }}
                           </a>
                           <em class="cff pl20">
                            @if(($ljobs->salary_lower == 0 || empty($ljobs->salary_lower)) && ($ljobs->salary_high == 0 || empty($ljobs->salary_high)))
                            面议
                            @elseif(($job->salary_lower == 0 || empty($ljobs->salary_lower)) && $ljobs->salary_high > 0)
                            {{$ljobs->salary_high}}k以下
                            @else
                            {{ $ljobs->salary_lower }}k-{{ $ljobs->salary_high }}k
                            @endif
                           </em>
                       </p>
                       <p class="fs14 c9 pl10">
                           <a href="{{ url('/company/detail?typeid=2&comid='.$ljobs->company_id) }}" target="_self" class="fs14 c3">
                               {{ str_limit($ljobs->company->name,16) }}
                           </a>
                           <em class="c9 fr pr10">[{{ str_limit($ljobs->areas->title,6) }}]</em>
                       </p>
                    </div>
                    @endforeach
                </div>
            </div>
            @endif
        </div>
        <div class="clr"></div>
    </div>
    @endif
</div>
@if(count($jobs->examination)>0 && $jobs->test == 1 && (empty($isToDelivery)|| $isToDelivery == 0))
<div class="modal fade bs-example-modal-lg" id="examination" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
  <div class="modal-dialog modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">@if(Auth::user()) 应聘考试 @else 系统提示 @endif</h4>
      </div>
      <div class="modal-body clearfix">
        @if(Auth::user())
        <form id='examForm'>
            @foreach($questions as $key=>$ques)
            <div class="form-group clearfix">
                <div class="col-xs-12">
                   {{$key+1}}、 {{$ques->title}}
                </div>
                <div class="col-xs-12 margin-l-20 margin-t-10"> 
                    {!! $ques->options !!}
                </div>
                <div class="col-xs-12 margin-l-20 margin-t-10"> 
                    @if($ques->question_type == 1)
                    @if($ques->questions_num==1)
                    <label><input type="checkbox" name="question_{{$ques->id}}[]" value="A">&nbsp;&nbsp;&nbsp;A</label>&nbsp;&nbsp;&nbsp;
                    @elseif($ques->questions_num==2)
                    <label><input type="checkbox" name="question_{{$ques->id}}[]" value="A">&nbsp;&nbsp;&nbsp;A</label>&nbsp;&nbsp;&nbsp;
                    <label><input type="checkbox" name="question_{{$ques->id}}[]" value="B">&nbsp;&nbsp;&nbsp;B</label>&nbsp;&nbsp;&nbsp;
                    @elseif($ques->questions_num==3)
                    <label><input type="checkbox" name="question_{{$ques->id}}[]" value="A">&nbsp;&nbsp;&nbsp;A</label>&nbsp;&nbsp;&nbsp;
                    <label><input type="checkbox" name="question_{{$ques->id}}[]" value="B">&nbsp;&nbsp;&nbsp;B</label>&nbsp;&nbsp;&nbsp;
                    <label><input type="checkbox" name="question_{{$ques->id}}[]" value="C">&nbsp;&nbsp;&nbsp;C</label>&nbsp;&nbsp;&nbsp;
                    @elseif($ques->questions_num==4)
                    <label><input type="checkbox" name="question_{{$ques->id}}[]" value="A">&nbsp;&nbsp;&nbsp;A</label>&nbsp;&nbsp;&nbsp;
                    <label><input type="checkbox" name="question_{{$ques->id}}[]" value="B">&nbsp;&nbsp;&nbsp;B</label>&nbsp;&nbsp;&nbsp;
                    <label><input type="checkbox" name="question_{{$ques->id}}[]" value="C">&nbsp;&nbsp;&nbsp;C</label>&nbsp;&nbsp;&nbsp;
                    <label><input type="checkbox" name="question_{{$ques->id}}[]" value="D">&nbsp;&nbsp;&nbsp;D</label>&nbsp;&nbsp;&nbsp;
                    @endif
                    @else
                    @if($ques->questions_num==1)
                    <label><input type="radio" name="question_{{$ques->id}}" value="A">&nbsp;&nbsp;&nbsp;A</label>&nbsp;&nbsp;&nbsp;
                    @elseif($ques->questions_num==2)
                    <label><input type="radio" name="question_{{$ques->id}}" value="A">&nbsp;&nbsp;&nbsp;A</label>&nbsp;&nbsp;&nbsp;
                    <label><input type="radio" name="question_{{$ques->id}}" value="B">&nbsp;&nbsp;&nbsp;B</label>&nbsp;&nbsp;&nbsp;
                    @elseif($ques->questions_num==3)
                    <label><input type="radio" name="question_{{$ques->id}}" value="A">&nbsp;&nbsp;&nbsp;A</label>&nbsp;&nbsp;&nbsp;
                    <label><input type="radio" name="question_{{$ques->id}}" value="B">&nbsp;&nbsp;&nbsp;B</label>&nbsp;&nbsp;&nbsp;
                    <label><input type="radio" name="question_{{$ques->id}}" value="C">&nbsp;&nbsp;&nbsp;C</label>&nbsp;&nbsp;&nbsp;
                    @elseif($ques->questions_num==4)
                    <label><input type="radio" name="question_{{$ques->id}}" value="A">&nbsp;&nbsp;&nbsp;A</label>&nbsp;&nbsp;&nbsp;
                    <label><input type="radio" name="question_{{$ques->id}}" value="B">&nbsp;&nbsp;&nbsp;B</label>&nbsp;&nbsp;&nbsp;
                    <label><input type="radio" name="question_{{$ques->id}}" value="C">&nbsp;&nbsp;&nbsp;C</label>&nbsp;&nbsp;&nbsp;
                    <label><input type="radio" name="question_{{$ques->id}}" value="D">&nbsp;&nbsp;&nbsp;D</label>&nbsp;&nbsp;&nbsp;
                    @endif
                    @endif
                </div>
            </div>
            @endforeach
            {!! csrf_field() !!}
            <input type="hidden" name="ehtime" value="{{$jobs->examination->times}}">
            <input type="hidden" name="company_id" value="{{$company->id}}">
            <input type="hidden" name="job_id" value="{{$jobs->jobs_id}}">
            <input type="hidden" name="examination_id" value="{{$jobs->examination->id}}">
        </form>
        @if(!empty($jobs->examination->times))
        <div class="float-r" id="counterdown"></div>
        <script type="text/javascript">
        $(function(){
            var times = '{{$jobs->examination->times}}';
            var setimes = times*60-1;
        	var hour = Math.floor((setimes / 3600) % 24);
        	var minite = Math.floor((setimes / 60) % 60);
        	var second = Math.floor(setimes % 60);
        	$('#examination').on('shown.bs.modal', function () {
        		 var html = $('#counterdown').html();
        		 if(html.lenght <= 0 || html == ''){
                     $('#counterdown').countdown({
                        image: '{{asset("/images/digits.png")}}',
                        startTime: hour+":"+minite+":"+second,
                        timerEnd: function(){
                        	deliveryResume('/member/examination/resume','examForm');
                        	$('#examination').modal('hide')
            			},
                        format: 'hh:mm:ss'
                      });
        		 }
    		});
        });
        </script>
        @endif
        @else
        <div class="font-16 text-center"><font color="red">您当前尚未登录，请先登录！</font></div>
        @endif
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" id="submittags" data-dismiss="modal">关闭</button>
        @if(Auth::user())<button type="button" class="btn btn-primary" data-dismiss="modal"  onclick="deliveryResume('/member/examination/resume','examForm')">提交</button>@endif
      </div>
    </div>
  </div>
</div>
@endif
<script type="text/javascript">
<!--
$('input').iCheck({
	checkboxClass: 'icheckbox_flat-blue',
    radioClass: 'iradio_flat-blue',
    increaseArea: '-10' // optional
});
//-->
</script>
@stop

@section('footer')
@parent
@stop

